package com.xiaode.controller.admin.face;

import com.jfinal.kit.Kv;
import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.xiaode.common.model.UserFaceLog;

public class UserFaceService {
	
	/**
	 * 人脸数据列表
	 */
	public Ret getFacePage(Integer grade, Integer clasId, Integer examineState, Integer page, Integer limit) throws Exception {
		
		Kv kv = Kv.create();
		kv.setIfNotNull("grade", grade);
		kv.setIfNotNull("clasId", clasId);
		kv.setIfNotNull("examineState", examineState);
		Page<Record> recordPage = Db.template("studentFaceList", kv).paginate(page, limit) ;
		for(Record record : recordPage.getList()) {
			UserFaceLog userFaceLog = UserFaceLog.dao.findById(record.getInt("faceLogId"));
			record.put("userFaceLog", userFaceLog);
		}
		
		return Ret.ok("studentFacePage", recordPage);
	}



	
}

